package com.spzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spzx.domain.ProductUnit;
import com.spzx.mapper.ProductUnitMapper;
import com.spzx.service.ProductUnitService;
import org.springframework.stereotype.Service;

import javax.management.Query;
import java.sql.Wrapper;
import java.util.List;

@Service
public class ProductUnitServiceImpl extends ServiceImpl<ProductUnitMapper, ProductUnit> implements ProductUnitService {
    @Override
    public List<ProductUnit> getList(ProductUnit productUnit) {
        String remark = productUnit.getRemark();
        String name = productUnit.getName();
        QueryWrapper<ProductUnit> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(name != null && name != "", "name", name);
        queryWrapper.like(remark != null && remark != "", "remark", remark);
        return this.list(queryWrapper);
    }
}
